<extend name="Home@Base/common" />

<block name="body">
<style>
#tips {
	margin: 20px 10px;
	display: none;
}
#tips p{
	margin-top: 10px;
}
</style>
<div class="span9 page_message">
	<section id="contents">
		<include file="Home@Addons/_nav" />
		<div class="tab-content">
			<form action="{:U('config')}" class="form-horizontal" method="post">
				<empty name="custom_config"> <foreach name="data['config']"
					item="form" key="o_key">
				<div class="form-item cf">
					<if condition="$form['type']!='hidden'"> <label
						class="item-label"> {$form.title|default=''} <present
							name="form.tip"> <span class="check-tips">{$form.tip}</span>
						</present>
					</label> </if>
					<switch name="form.type"> <case value="hidden"> <input
						type="hidden" name="config[{$o_key}]" value="{$form.value}">
					</case> <case value="radio">
					<div class="controls">
						<foreach name="form.options" item="opt" key="opt_k"> <label
							class="radio"> <input type="radio"
							name="config[{$o_key}]" value="{$opt_k}"
						<eq name="form.value" value="$opt_k"> checked</eq>>{$opt}
						</label> </foreach>
					</div>
					</case> <case value="material">
					<div id="material_{$o_key}"></div>
					{:hook('material', array('name'=>$o_key,'value'=>$form['value']))}

					</case> </switch>

				</div>
				</foreach> </empty>
				<div id="tips">
					<p>
						微信多客服系统地址：<a href="https://mpkf.weixin.qq.com">https://mpkf.weixin.qq.com</a>
					</p>
					<p>
						具体使用教程：<a href="http://kf.qq.com/product/weixinmp.html#hid=121">http://kf.qq.com/product/weixinmp.html#hid=121</a>
					</p>
				</div>
				<input type="hidden" name="id" value="{$data.id}" readonly>
				<button type="submit" class="btn submit-btn ajax-post"
					target-form="form-horizontal">确 定</button>

			</form>
		</div>
	</section>
</div>
</block>

<block name="script"> <script type="text/javascript"
	charset="utf-8">
	$(function() {
		var val = $("input[name='config[data_type]']:checked").val();
		switchTap(val);
		$("input[name='config[data_type]']").click(function() {
			var val = $(this).val();
			switchTap(val);
		})
		console.log(val)
	})
	function switchTap(val) {
		if (val == 0) {
			$('.form-item').eq(1).show();
			$('#tips').hide();
		} else {
			$('.form-item').eq(1).hide();
			$('#tips').show();
		}
	}
</script> </block>
